/**
 * 
 */
package org.istt.dao;

import java.util.Date;
import java.util.List;

import org.displaytag.properties.SortOrderEnum;
import org.istt.domain.FileManagement;
import org.istt.domain.User;

/**
 * @author Huy
 *
 */
public interface FileMgrDao extends Dao<FileManagement, Long> {
	
	/**
	 * get the list of files according to field ID, content and returned date
	 * @param fieldId the field Id
	 * @param content the content of the file
	 * @param toDate the returned date
	 * @return list of file
	 */
	List<List<Object>> find(Long fieldId, String content, Date toDate);
	/**
	 * Get the number of files that included in
	 * @param fileId
	 * @return the number of files
	 */
	int countByFileId(String fileId);
	
	/**
	 * Update approver for current file
	 * @param fmgrIds
	 */
	void approveOfLatestFile(String[] fmgrIds, User approver);
	List<FileManagement> findFileMgrs(String fileId, Boolean activeStatus, Integer position);
	
	/**
	 * Remove all the file marked with approve status equal to false
	 * @param ids
	 */
	void removeAmendment(Long[] ids);
	
	/**
	 * Get the list of amendment file
	 * @param firstRecordIndex
	 * @param pageSize
	 * @param sortDirection
	 * @param sortCriterion
	 * @return
	 */
	List<FileManagement> getAmendmentFile(Long userId, int firstRecordIndex, int pageSize,
			SortOrderEnum sortDirection, String sortCriterion);
	
	/**
	 * Get the number of amendment file
	 * @return
	 */
	int getAmendmentFileRecordCount(Long userId);
	
	/**
	 * Get current step number
	 * @param fileId
	 * @return
	 */
	int getCurrentStep(String fileId);
	
	/**
	 * Get current step processing
	 * @param fileId
	 * @return
	 */
	FileManagement getCurrentStepProcess(String fileId);
}
